package com.yun.service;

import com.yun.mapper.UserSupportFaceMapper;
import com.yun.pojo.UserSupportFace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.Valid;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * Created by qzy017 on 2019/6/28.
 */
@Transactional
@CacheConfig(cacheNames="UserSupportFace") //抽取缓存的公共配置
@Service
public class UserSupportFaceService {

  @Autowired
    UserSupportFaceMapper userSupportFaceMapper;
    public void addFace(UserSupportFace userSupportFace) {

        userSupportFaceMapper.addFace( userSupportFace);

    }




    //根据用户的手环id 查找数据

    @Cacheable(value ="UserSupportFace",key = "#userSupportFace.supportId")
    public List<LinkedHashMap> getUserIdOpenIdBySupportId(UserSupportFace userSupportFace) {

      return   userSupportFaceMapper.getUserIdOpenIdBySupportId( userSupportFace);
    }


  //拿到所有的终端
    public String   selectAllterminal( UserSupportFace userSupportFace) {

      return   userSupportFaceMapper.selectAllterminal( userSupportFace);
    }
}
